package czk.concrent.threadpool.extend;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/7/31 17:41
 */
public class MyThread extends Thread {
    private String username;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public MyThread(String username) {
        super();
        this.username = username;
    }

    @Override
    public void run() {
        try {
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
            System.out.println("线程名："+username+"  开始时间："+simpleDateFormat.format(new Date()));
            Thread.sleep(2000);
            System.out.println("线程名："+username+"  结束时间："+simpleDateFormat.format(new Date()));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
